package wiiusej.apptest.generalTasks;

import java.util.concurrent.Callable;

import org.apache.log4j.Appender;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

public class EnableMotionTask implements Callable{

	static Logger fileLogger;
	
	private static boolean motionButtonState;
	
	public EnableMotionTask(Logger fileLogger, boolean motionButtonState){
		
		
		PropertyConfigurator.configure("log4j.properties");
		this.fileLogger = Logger.getLogger("motionSensor");
		
		this.motionButtonState = motionButtonState;
		
		/*
		Appender motionTaskAppender = fileLogger.getAppender("motionTask");
		fileLogger.addAppender(motionTaskAppender);*/
		
	}
	
	
	@Override
	public Boolean call() throws Exception {
		
		if(!motionButtonState){
    		//First time button is "just" pressed - this will make available the
    		//motion capture			
			fileLogger.info("Start Recording ACCELERATION");
			motionButtonState = true; 
    		//captures++;	    		
    	}else{
    		//Disable the motion capture
    		fileLogger.info("Stop Recording ACCELERATION");
    		motionButtonState = false;
    	}	    	
				
		return motionButtonState;
	}

}
